<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>BHUDY - 登录</title>
    <link rel="icon" href="/res/images/ico.png" type="image/x-icon">
    <link href="/res/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <script src="/res/js/bhudy.js"></script>
    <script src="/res/bootstrap/js/bootstrap.min.js"></script>
    <script src="/res/layui/layui.all.js"></script>
</head>
<body>
<div class="container-fluid">
    <form class="form-horizontal">
        <div class="form-group">
            <label for="name" class="col-sm-2 control-label">账号：</label>
            <div class="col-sm-10">
                <input type="text" id="name" class="form-control" name="name"/>
            </div>
        </div>
        <div class="form-group">
            <label for="password" class="col-sm-2 control-label">密码：</label>
            <div class="col-sm-10">
                <input type="password" id="password" class="form-control" name="password"/>
            </div>
        </div>
        <div class="form-group">
            <div class="col-sm-offset-2 col-xs-4">
                <button type="button" class="btn btn-info">注册</button>
            </div>
            <div class="col-xs-offset-4 col-xs-2">
                <button id="login" type="button" class="btn btn-success">登录</button>
            </div>
        </div>
    </form>
</div>
</body>
<script>
    $("#login").click(function () {
        var data = "loginCode=" + $("#name").val() + "&password=" + $("#password").val();
        $.getJsonPOST("/api/v1/sysLogin", data, function (resultData) {
            if (resultData.code == 10001) {
                window.location.replace(resultData.data.url);
            } else {
                layer.msg(resultData.message);
            }
        })
    });
</script>
</html>

